package com.rw.bootdemo.config;

import org.springframework.amqp.core.AmqpTemplate;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

@Component
public class MQProducer {
    @Value("${app.rabbitmq.exchangeName}")
    String exchangeName;
    final AmqpTemplate amqpTemplate;
    public MQProducer(AmqpTemplate amqpTemplate) {
        this.amqpTemplate = amqpTemplate;
    }
    public void send(String routingKey, String msg) {
        amqpTemplate.convertAndSend(exchangeName, routingKey, msg);
    }
}
